(function(a,s){"use strict";var e="bx-lazyload-watch";var l="bx-lazyload-loading";var t="bx-lazyload-success";var r="bx-lazyload-error";var c="bx-lazyload-hidden";var o="data:image/svg+xml,%3Csvg width='1px' height='1px' xmlns='http://www.w3.org/2000/svg'%3E%3C/svg%3E";var i=null;var d=function a(s,d){var n=s.dataset.lazyloadSuccessClass?s.dataset.lazyloadSuccessClass.split(" "):[];delete s.dataset.lazyloadSuccessClass;n=[t].concat(babelHelpers.toConsumableArray(n));var f=s.dataset.lazyloadErrorClass?s.dataset.lazyloadErrorClass.split(" "):[];delete s.dataset.lazyloadErrorClass;f=[r].concat(babelHelpers.toConsumableArray(f));s.classList.add(l);var y=new Image;y.src=s.dataset.lazyloadSrc;if(!s.dataset.lazyloadHiddenSrc){s.dataset.lazyloadHiddenSrc=s.src}y.onload=function(){var a;if(s.classList.contains(c)){return false}if(s.dataset.lazyloadSrc){s.src=s.dataset.lazyloadSrc}s.classList.remove(l);(a=s.classList).add.apply(a,babelHelpers.toConsumableArray(n));if(typeof s.lazyloadCallback==="function"){s.lazyloadCallback({element:s,state:"success"});delete s.lazyloadCallback}};y.onerror=function(){var a;if(s.classList.contains(c)){return false}s.classList.remove(l);(a=s.classList).add.apply(a,babelHelpers.toConsumableArray(f));s.title="";s.alt="";if(typeof s.lazyloadCallback==="function"){s.lazyloadCallback({element:s,state:"error"});delete s.lazyloadCallback}else{s.src=o}};if(typeof s.dataset.lazyloadDontHide!=="undefined"){s.classList.remove(e);delete s.dataset.lazyloadDontHide;if(i){i.unobserve(s)}}};if(typeof window.IntersectionObserver!=="undefined"){i=new IntersectionObserver((function(a,s){a.forEach((function(a){var s=a.target;if(s.classList.contains(r)){return true}if(a.isIntersecting){if(s.classList.contains(c)){if(s.dataset.lazyloadSrc){s.src=s.dataset.lazyloadSrc}s.classList.remove(c)}else if(s.classList.contains(e)){return true}else{s.classList.add(e);d(s)}}else{if(s.classList.contains(c)||!s.classList.contains(e)){return true}if(s.dataset.lazyloadHiddenSrc){s.src=s.dataset.lazyloadHiddenSrc}s.classList.remove(l);s.classList.add(c)}}))}),{threshold:[0,1]})}s.BitrixVue.directive("bx-lazyload",{bind:function a(s,e){if(babelHelpers["typeof"](e.value)==="object"&&typeof e.value.callback==="function"){s.lazyloadCallback=e.value.callback}if(!s.src||s.src===location.href.replace(location.hash,"")){s.src=o}if(i){i.observe(s)}else{d(s)}},componentUpdated:function a(s){if(!s.classList.contains(t)&&!s.classList.contains(r)&&!s.classList.contains(e)&&!s.classList.contains(l)){s.classList.add(l)}else if((s.classList.contains(t)||s.classList.contains(r))&&s.dataset.lazyloadSrc&&s.dataset.lazyloadSrc!==s.src){if(!s.dataset.lazyloadSrc.startsWith("http")){var c=document.createElement("a");c.href=s.dataset.lazyloadSrc;if(c.href===s.src){return}}d(s)}},unbind:function a(s){if(i){i.unobserve(s)}}})})(this.window=this.window||{},BX);
//# sourceMappingURL=lazyload.bundle.map.js